#pragma once

#include "windows.h"
#include <string>
#include <boost/shared_array.hpp>
using namespace std;
using namespace boost;
class MyCloseHandle
{
public: 
	MyCloseHandle(HANDLE handle):m_handle(handle){}
	~MyCloseHandle(){
		CloseHandle(m_handle);
	}
protected:
private:
	HANDLE m_handle;
};

enum HTTPTYPE{HTTPORTEXT = 0,UNKNOW_TYPE};


int QueryURLType(HINTERNET hinternet);

void WriteToFile (wchar_t *filepath,const void *buffer,size_t bufferlength);


shared_array<wchar_t> a2w(const char* buffer);

shared_array<char> WideCharToMultiChar(const wchar_t* str,size_t len);


shared_array<char> ConvertUTF8toGB2312(const char *pData, size_t size,size_t &outsize);
